//
//  CZStatusRetweetView.swift
//  WHWeiBo01
//
//  Created by 炜张 on 16/7/13.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

//转发微博的视图
class CZStatusRetweetView: UIView {
 
    //传转发的文字
    var statuViewModel: CZStatusViewModel? {
        didSet {
            //赋值
            contentLabel.text = statuViewModel?.retweetContent
            print(contentLabel.text)
        }
    }
    
    //懒加载控件
    private lazy var contentLabel: UILabel = {
        let label = UILabel(textColor: UIColor.darkGrayColor(), font: 14)
        //分行
        label.numberOfLines = 0
        return label
    }()
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        //调用
        setUpUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    //设置约束
    private func setUpUI() {
        contentLabel.backgroundColor = UIColor(white: 0.95, alpha: 1)
        //添加控件
        addSubview(contentLabel)
        //设置约束
        contentLabel.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self).offset(HomeCellMargin)
            make.leading.equalTo(self).offset(HomeCellMargin)
            make.trailing.equalTo(self).offset(-HomeCellMargin)
        }
        
        //关键约束 微博视图底部约束等于我们转发的微博的底部加个高度
        self.snp_makeConstraints { (make) -> Void in
            make.bottom.equalTo(contentLabel).offset(HomeCellMargin)
        }
    }
}












